package com.sunwayworld.basemodule.business.qualitycontrol.qualitycontrolresult.dao.impl;

import com.sunwayworld.basemodule.business.qualitycontrol.qualitycontrolresult.bean.LimsQualitycontrolTestResultBean;
import com.sunwayworld.basemodule.business.qualitycontrol.qualitycontrolresult.dao.LimsQualitycontrolTestResultDao;
import com.sunwayworld.basemodule.business.qualitycontrol.qualitycontrolresult.mapper.LimsQualitycontrolTestResultMapper;
import com.sunwayworld.framework.mybatis.dao.MybatisDaoSupport;
import com.sunwayworld.framework.mybatis.mapper.MapperParameter;
import com.sunwayworld.framework.spring.annotation.GikamBean;
import com.sunwayworld.framework.support.PersistableMetadataHelper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import java.util.List;
import java.util.Map;

@Repository
@GikamBean
public class LimsQualitycontrolTestResultDaoImpl extends MybatisDaoSupport<LimsQualitycontrolTestResultBean, Long> implements LimsQualitycontrolTestResultDao {

    @Autowired
    private LimsQualitycontrolTestResultMapper limsQualitycontrolTestResultMapper;

    @Override
    public LimsQualitycontrolTestResultMapper getMapper() {
        return limsQualitycontrolTestResultMapper;
    }

    @Override
    public List<Map<String, Object>> selectDistinctRows(MapperParameter parameter) {
        parameter.setTableName(PersistableMetadataHelper.getTableName(this.getType()));
        return this.getMapper().selectDistinctRows(parameter);
    }

    @Override
    public double selectAverageForHistory(String mainBatchCode, String controlMaterialLevel, String productName) {
        return getMapper().selectAverageForHistory(mainBatchCode, controlMaterialLevel, productName);
    }

    @Override
    public double selectSDForHistory(String mainBatchCode, String controlMaterialLevel, String productName) {
        return getMapper().selectSDForHistory(mainBatchCode, controlMaterialLevel, productName);
    }
}
